package com.qingsong.util;

import com.alipay.easysdk.kernel.Config;

/** @author JoeZhou */
public class AlipayUtil {

    /** 应用ID */
    private static final String APPID = "9021000143671137";
    /** 异步通知接口（下单成功后支付宝回调） */
    private static final String NOTIFY_URL = "http://f58872f.r36.cpolar.top/api/v1/order/prePayNotify";
    /** 支付宝公钥 */
    private static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA63i5AxBzjBV"+
            "mdwVNfhfiHh6iqF2HqUVF4XnMBaKHA0Gh0iE6paaDx9iew3VyFQuu3SuznwCIvlf3wN9Ierl5cOS4agp24GoGK94I7Suwjvk"+
            "7QW714KlwLbta8YhOIHtlG46LWBBNjCf2NC3fCQIc7g0auIfrkwuxZrh968wwo4rom/aQ/+B3dam7U+8Ps7RjW7atTD1Cd3LJ"+
            "wUtk8KqQVFK6uGVjgZpl+07EtKvt/qzxGCZhudhGsuqgLBx4l6X5yTVBCtRDPhYKvEctoLAyKE0bIjCk+oImS1uNiuWMvbiuC4"+
            "LVH9S/hwOOCAfb6dIMdzZ6Lc7oM2T3j92yhdySAwIDAQAB";
    /** 应用私钥 */
    private static final String MERCHANT_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCsWHe"+
            "hmJYIOlvBU3u6BZh8HEFp88rDEtHhcNmDZyFewg14fdfC3qivg1ojk0n8DifYqI8m0L9XwC15qCEYiChp6V8C846o5CAoGng1J"+
            "nJtcju2j/mqfrRl3EVcc7BKE9kIE3OWPW/ZxgpdefevJsdVcvRwmvlZiBn2E/oChXTh9PaOfGi0HQA9Wpsc1s9O8ZKKciEt4Exn"+
            "EycPRkyAd3pKwH1dtn7y5rJF7SsIb6bs4IPFpbSZ0MEYaCpI2vMNyE0BfIZuzefh8jGDAyUzNF6zWVm6wfBR6x9MAPJqtUNb8lt8"+
            "vSL9TELciKYEG09KTfoPzYnwfKuaksvcOR5sWyiVAgMBAAECggEAY+YT0hOEQ9iv/uvJOBauQKKQOD4cNd7e0XJ8YnKRIUASVtl7"+
            "C3XNCY913FEv/W6nIiryb2lowBChS3dtV6703g9sB2XuN2+kRBqzuvtCMLaabkQeT/mJz9FSUzir4wSGNOwxf9C02OK2d2CPdXNg"+
            "7+LmVa8/AeqmQcFqlbOOALrqZhImTeheHv1SahRre8uAU4AXPHOvKTiekUxWaneOW0zrU7sPaHbxZou5fePqvROA7vNtmWambhbSK"+
            "Cw7Th/b4CU+l5jTmiC7yYtJ8ESsd3lpwhApwlqxBs4wC7AZEjow32+QH8bhtQp+WsJ/41EaCDEUIppoBexX/9nYT5jlgQKBgQD5WX"+
            "PXzB19QarqNZg3QCLfLqgVp64QR80Gwp9DmwDqrkP4CtLLlE4YqCPlLbaRRGy4Lcfu67tCMrXSBKQF8Ue8Kji2cqGsSsz00n9sT74"+
            "oGpifFUuqXMJiB3U6MOsW+2bhI4zebhuoJ/iNCId50PPvaztF7yJXksYKHIdSGdCJyQKBgQCw8TxYg5+TUp9tWxvWWfeea6nXXGUa"+
            "a9SCMLTkWis2t+6wLePQdUbwKWIV45T8h0gPLpnkwSrD2G0KIM4t3tUxmxCa0oelQ7b5gAbyalTWQWBMsmNMKuERXCoX2kHTTJo6l"+
            "ja2llAbEdsXycjB5E5VaOWjUsvgK//Fd6fuYouObQKBgE/iPJ6yIfBzDVKjgPSSc5mU1Py7D6Tfm+vChkueaRjGY7gfn5DhHnP/yi"+
            "AuGQNJLJuE7zy4APIgVOfH3NSajCTYUfsBlpIgFLGKjpAgrAclHig5JliaBxxoz0GpUme2eys9vG+2Tt38kEB+rwhzzPKzI/Yvuoz"+
            "b1N6AbUn8QzchAoGAS2/+H2q2jRPrvq7aVm/y/0q9lYDh5frVFlB3vuemhuSyUdCu0QA/J0Mte1GVAnkWwspGeF3Wwrqx+mB0JuBb"+
            "GpQW5zsc89vD1em8jHvDAbnLucdQSHf7jvAxTgwShmihVJsYZo39Rx08wI6aFfglYYqgZRp2q3N2z5StNxgykZ0CgYAk9cEkKb3+Gh"+
            "jsBE7HJCYT8C5+xS726Pdvv1mWg8hBjQySc3AewXzTKJRIbHglGnX366p2Ey2J1Ob8GYiTVmOOrexvPfoBfM2lpb0nifHS7WDUA3lF"+
            "yQvqcPdySN2ZZMQDpFiUk66Vkt70EDxKw6ifrNYncGw2EftTOvq8Fjx1YA==";
    /** 单例的Alipay配置对象 */
    private static volatile Config config;
    /** 单例对外方法 */
    public static Config getConfig() {
        if (config == null) {
            synchronized (AlipayUtil.class) {
                if (config == null) {
                    config = new Config();
                    config.protocol = "https";
                    config.gatewayHost = "openapi-sandbox.dl.alipaydev.com";
                    config.signType = "RSA2";
                    config.ignoreSSL = true;
                    config.appId = APPID;
                    config.alipayPublicKey = ALIPAY_PUBLIC_KEY;
                    config.merchantPrivateKey = MERCHANT_PRIVATE_KEY;
                    config.notifyUrl = NOTIFY_URL;
                }
            }
        }
        return config;
    }
}